﻿using FireChat.Share.Web.Package;
using Newtonsoft.Json.Linq;

namespace FireChat.Share.Web.Util;



/// <summary>
/// 数据包脚手架
/// </summary>
public static class PackageScaffold
{
    /// <summary>
    /// 获取包内参数实例
    /// </summary>
    public static T? GetDataInstance<T>(this IPackage package) where T : class
    {
        if (package?.Data is null) return default;

        return (package.Data as JObject)?.ToObject<T>();
    }
}